<?php
/**
 * 构建车辆 指挥类
 * 2019年12月7日06:20:30
 */
namespace Application\Common\Builder;

class VehicleDirectorNoUseBuilder
{
    // 车辆类-实例对象
    protected $vehicle;
    // 构造函数-传入车辆对象
    public function __construct($vehicle)
    {
        $this -> vehicle = $vehicle;
    }
    // 构建车辆
    public function createVehicle($vehicle_data)
    {
        if(empty($vehicle_data) && is_array($vehicle_data)){
            return false;
        }
        foreach($vehicle_data as $k => $v){
            $function = 'add'.ucfirst($k);
            $this -> vehicle -> $function($v);
        }
    }
    // 展示汽车
    public function showVehicle()
    {
        return $this -> vehicle -> display();
    }
}
